High-performance RPC communication for UTCP
The gRPC provider enables UTCP to interact with gRPC services, providing efficient, schema-driven communication with high performance, low latency, and strong typing. This provider is ideal for microservices architectures and high-throughput applications.
gRPC providers are configured using the following JSON structure:
{ "name": "grpc_service", "provider_type": "grpc", "host": "api.example.com", "port": 50051, "service_name": "Calculator", "method_name": "Add", "use_ssl": true, "auth": { "auth_type": "api_key", "api_key": "YOUR_API_KEY", "var_name": "x-api-key" } }
Field | Required | Description |
---|---|---|
name |
Yes | Unique identifier for the provider |
provider_type |
Yes | Must be set to "grpc" |
host |
Yes | Hostname or IP address of the gRPC server |
port |
Yes | Port number of the gRPC server |
service_name |
Yes | Name of the gRPC service to call |
method_name |
Yes | Name of the method to call on the service |
use_ssl |
No | Whether to use SSL/TLS for the connection (default: false ) |
auth |
No | Authentication configuration (if required) |
timeout |
No | Request timeout in seconds (default: 30 ) |
proto_file |
No | Path to the protocol buffer definition file |
gRPC providers support several authentication methods:
{ "auth": { "auth_type": "api_key", "api_key": "YOUR_API_KEY", "var_name": "x-api-key" } }
{ "auth": { "auth_type": "oauth2", "token": "YOUR_ACCESS_TOKEN" } }
{ "auth": { "auth_type": "tls_client_cert", "cert_file": "/path/to/client.crt", "key_file": "/path/to/client.key" } }
Since gRPC doesn't natively support dynamic discovery, UTCP tools can be discovered through:
/utcp
{ "name": "grpc_service", "provider_type": "grpc", "host": "api.example.com", "port": 50051, "discovery_url": "https://api.example.com/utcp" }
The discovery endpoint should return a UTCPManual
object as described
in the For Tool Providers section.
{ "name": "calculator", "provider_type": "grpc", "host": "calc.example.com", "port": 50051, "service_name": "Calculator", "method_name": "Add", "use_ssl": true, "timeout": 10 }
{ "name": "user_service", "provider_type": "grpc", "host": "users.example.com", "port": 443, "service_name": "UserService", "method_name": "GetUser", "use_ssl": true, "auth": { "auth_type": "oauth2", "token": "your_access_token" } }
© 2024 Universal Tool Calling Protocol. All rights reserved.